package com.jse.job;

import org.nutz.dao.Dao;
import org.nutz.integration.quartz.annotation.Scheduled;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.jse.db.MysqlBak;

@IocBean
@Scheduled(cron = "0 0 2 * * ?") // 直接使用注解来声明cron
public class BakQuartz implements Job {

	private static final Log log = Logs.get();
	@Inject
	Dao dao;
	@Inject("conf")
	PropertiesProxy conf;

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		String taskId = context.getJobDetail().getKey().getName();
		log.info("Test Job taskId::" + taskId);
		MysqlBak.exec(conf.get("bak.name"), conf.get("bak.path"));
	}
}
